<?php

namespace App\Http\Requests\Admin;

class LoginRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $arr = [
            'username' => [
                'required',
//                'exists:admin_user'
            ],
            'password' => 'required|string',
        ];
        $combine = array_merge($this->rules,$arr);
        return $combine;
    }

    /*
     * 错误信息
     */
    public function messages()
    {

        $arr = [
            'exists' =>':attribute 不存在',
            'min' => ':attribute 长度不小于6位',
            'max' =>':attribute 长度不大于20位',
        ];
        $combine = array_merge($this->errMsg,$arr);

        return $combine;
    }

    /*
     * 错误参数名
     */
    public function attributes()
    {

        $arr = [
            'username' => '用户名',
            'password' => '密码'
        ];
        $combine = array_merge($this->attr,$arr);

        return $combine;
    }
}
